<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>西闽科仪 管理系统控制台</title>
<link rel="stylesheet" href="/public/layout/css/layout.css" type="text/css" media="screen" />
<!--[if lt IE 9]>
<link rel="stylesheet" href="/public/layout/css/ie.css" type="text/css" media="screen" />
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="/public/layout/js/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="/public/layout/js/hideshow.js" type="text/javascript"></script>
<script src="/public/layout/js/jquery.tablesorter.min.js" type="text/javascript"></script>
<script charset="utf-8" src="/public/kindeditor4110/kindeditor-min.js"></script>
<script charset="utf-8" src="/public/kindeditor4110/lang/zh_CN.js"></script>
<script type="text/javascript">
$(document).ready(function() { 
	$(".tablesorter").tablesorter(); 

	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	$("ul.tabs li").click(function() {
		$('#id').val('');
		$('#title').val('');
		$('#content').val('');
		
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	
	var KE = KindEditor.create('#content',{
        width : '98%',
        height: '400px',
        themeType : 'simple',
        uploadJson : '/public/kindeditor4110/php/upload_json.php',
        allowFileManager : false
	});
	
	$('a[ch]').click(function () {
		var ch = $(this).attr('ch');
		var id = $(this).attr('id');
		$("ul.tabs li:last").trigger('click');
		$('#id').val(id);
		$('#title').val('');
		$('#content').val('');
		$.get('/article/data?ch='+ch.toString()+'&id='+id.toString(), function (data) {
			$('#title').val(data['title']);
			KE.html(data['content']);
		}, 'json');
		return false;
	});
});
</script>
</head>
<body>
	
	<section id="secondary_bar">
		<div class="breadcrumbs_container">
			<article class="breadcrumbs">
			<a href="/frame" target="_parent">控制台</a>
			<div class="breadcrumb_divider"></div>
			<a href="#" class="current">{$ch_name}</a>
			</article>
		</div>
	</section><!-- end of secondary bar -->
	
	<section id="main" class="column">
		
		<h4 class="alert_info none">{$ch_name}</h4>
		
		<article class="module width_3_quarter">
		<header><h3 class="tabs_involved">{$ch_name}</h3>
		<ul class="tabs">
   			<li><a href="#tab1">清单</a></li>
    		<li><a href="#tab2">新增/修改</a></li>
		</ul>
		</header>

		<div class="tab_container">
			<div id="tab1" class="tab_content">
			<table class="tablesorter" cellspacing="0"> 
			<thead> 
				<tr> 
   					<th width="6%">&nbsp;</th> 
    				<th>标题</th> 
    				<th width="20%">创建时间</th> 
    				<th width="10%">操作</th> 
				</tr> 
			</thead> 
			<tbody> 
			<notempty name="list">
				<volist name="list" id="item">
				<tr> 
   					<td><input type="checkbox" value="{$item.id}"></td> 
    				<td>{$item.title}</td> 
    				<td>{$item.create_time}</td> 
    				<td><a href="###" ch="{$ch}" id="{$item.id}">修改</a>&nbsp;|&nbsp;<a href="/article/delete?ch={$ch}&id={$item.id}">删除</a></td> 
				</tr>
				</volist>
			<else/>
				<tr> 
    				<td colspan="4">没有数据</td> 
				</tr>
			</notempty>
			</tbody> 
			<tfoot>
				<tr> 
    				<td colspan="4" align="right">{$page}&nbsp;&nbsp;&nbsp;&nbsp;</td> 
				</tr>
			</tfoot>
			</table>
			</div><!-- end of #tab1 -->
			
			<div id="tab2" class="tab_content">
			
				<article class="module width_full">
				<form name="article-form" id="article-form" method="post" action="/article/save">
					<div class="module_content">
						<fieldset>
							<label>标题</label>
							<input type="text" name="title" id="title" value="" />
							<label>正文</label>
							<textarea rows="12" name="content" id="content"></textarea>
						</fieldset>
						<div class="clear"></div>
					</div>
					<footer>
						<div class="submit_link">
							<input type="submit" value="保存发布" class="alt_btn" />
							<input type="reset" value="重置" />
							<input type="hidden" name="id" id="id" value="{$id}"/>
							<input type="hidden" name="ch" id="ch" value="{$ch}"/>
						</div>
					</footer>
				</form>
				</article><!-- end of post new article -->
				<div class="clear"></div>
				<br/><br/>

			</div><!-- end of #tab2 -->
			
		</div><!-- end of .tab_container -->
		
		</article><!-- end of content manager article -->
		
		<div class="spacer"></div>
	</section>


</body>
</html>